home *** CD-ROM | disk | FTP | other *** search
- PI.DOC
- ------
- Instructions for PI.COM
- Print Interceptor 1.1 (3/88)
-
- (c)1988 E. Meyer
-
-
- PI (Print Interceptor) is a printer utility for all MSDOS systems
- (requires MS/PCDOS 2.x or higher). When run, PI.COM becomes a memory resident
- program that translates printer output according to a table that can be
- changed at will. Any outgoing ASCII code 00-FF can be redefined to another
- code, or string of codes, to be sent to your printer. This is a very general
- approach, with many possible applications, including:
-
- * IBM extended (foreign) characters can be emulated on LQ printers
-
- * Single-character "Macros" can produce predefined strings
-
- * The same file can print differently on different printers
-
- * Printer output can be entirely suppressed
-
- PI allows you to change the current definitions in two ways: with a text
- file full of definitions that you create; or with ESC codes that can be sent
- from other programs.
-
-
- 1. INSTALLING PI
-
- The PI.COM module, once installed, remains in memory until your computer
- is reset. There are two ways to install it. First you may simply type:
-
- A>pi
-
- This loads the module, but it is INACTIVE, and no redefinitions are in effect.
- You would have to define some characters, then make PI active, before printer
- output would be affected. (See below for how to do this.)
- Second, you may invoke PI with the name of a definition file:
-
- A>pi filename
-
- This loads the module, makes it ACTIVE, and implements any redefinitions in
- the file. (See below for the required file format.) In addition, this
- command may be repeated any number of times to install a new definition file.
-
-
- 2. DEFINITION FILES
-
- You can quickly establish a set of redefinitions for use with PI, using
- any text editor. Create a simple ASCII text file (say, MY.DEF), which you
- will use with PI:
- A>pi my.def
-
- The file may contain any number of statements like this:
-
- 128=67,8,44;
-
- Numbers are always decimal; blank space and carriage returns are ignored. PI
- interprets the example shown as a request to define character 128 as the three-
- byte sequence 67,8,44, and so on for each such statement in the file. Any
- characters not mentioned will be defined as themselves. Finally, PI will be
- made ACTIVE, enabling these definitions for use.
-
- The effect of the above example is to allow the IBM character capital-C-
- sedilla to print as capital-C, backspace, comma, which is a good facsimile on
- letter quality printers. Of course, definitions can be a single byte:
- "128=67;" would define it as capital-C alone. And definitions can be empty:
- "128=;" would define it as nothing, that is, a non-printing character.
-
- Each definition may be up to 32 bytes long, and PI has 6K (about 6000)
- bytes available for all definitions.
-
-
- 3. CONTROLLING PI
-
- If you just type "PI" with no arguments, you will be informed of the
- current status (whether PI is active, and whether print output is enabled).
- There is also a set of commands to change status:
-
- A>pi /a Make PI ACTIVE
- A>pi /i Make PI INACTIVE
-
- A>pi /d DISABLE print output
- A>pi /e ENABLE print output
-
- The "/D" command temporarily disables all output to the printer. Your
- software can operate as usual, thinking it's printing; but nothing will
- happen, in fact there need not even be a printer present. The current
- definitions are not affected.
-
-
- 4. PROGRAMMING PI
-
- You may never need to do anything further to control PI. However, if you
- do find a need, or become interested, PI responds to a set of ESC-commands,
- just like those that control your printer. You can install these commands in
- your word processor's printer controls section; put a set of them in a disk
- file to be COPYed to the printer for use; or use them in a program of your
- own, for example, to read in translation tables in some format other than that
- expected by PI.COM itself.
-
- When PI is "active", it is translating printer output according to any
- currently installed definitions. When it is "inactive", all output goes
- direct to the printer without translation. Keep these two states in mind:
- making PI inactive and defining every character as itself are NOT the same.
-
- Once again, after PI.COM is installed, these codes must be PRINTED to
- modify its behavior. Hexadecimal notation is used throughout here; decimal
- values are often shown in parentheses. Hex 1B is the ESCape code (27 decimal).
-
- PI INACTIVE. 1B FF 30 (27,255,48)
- This sequence temporarily "turns PI off", if you ever need a
- quick way to suspend translation.
-
- PI ACTIVE. 1B FF 31 (27,255,49)
- This sequence "turns PI on", enabling its translation of
- outgoing printer data according to any installed definitions.
-
- SET STANDARD ASCII. 1B FF 32 (27,255,50)
- This sequence defines every character as itself; useful as a
- starting point for further modifications.
-
- MASK PARITY. 1B FF 33 (27,255,51)
- This sequence defines ASCII 00-7F (0-127) as themselves, and
- ASCII 80-FF (128-255) as 00-7F (0-127) also. Effectively, this
- would "mask off" the high, or parity, bit on outgoing data.
-
- ERASE DEFINITIONS. 1B FF 34 (27,255,52)
- This sequence wipes out all ASCII codes, defining each as a
- null string. Only subsequently redefined codes will print.
-
- REDEFINE CODE. 1B FE aa nn b1 b2... (27,254,aa,nn,b1...)
- This sequence redefines any ASCII code "aa", for printing
- purposes, as a string of "nn" bytes, "b1 b2...".
-
-
- 5. ABOUT CONFLICTS
-
- PI uses just two uncommon ESC codes, which probably will not conflict
- directly with anything in your printer's command set. A more subtle problem
- is that PI might interfere with your use of printer ESC codes by attempting to
- translate them! PI tries to avoid this: it will never translate an ESC, nor a
- byte preceded by an ESC, so that, for example, if you use an ESC-E command it
- will not be affected by any translation of the character "E". But many
- printer sequences are longer than two bytes, and in these cases PI can't
- distinguish commands from data.
-
- To illustrate the problem, suppose you have been using the printer
- command ESC-r-nn, "1B 72 80" (27,114,128) to set the right margin to absolute
- column 128. If this occurs while PI is ACTIVE, with the redefinition in the
- example above, that final "128" is going to turn into "67,8,44" or whatever,
- resulting in setting a margin at column 67, plus some garbage. This is why
- you (may?) need to ensure that PI is INACTIVE when (some?) printer commands
- are being sent. There are two possible approaches.
-
- THE FAST AND LOOSE METHOD: in general, leave PI ACTIVE and don't worry;
- you may never see a problem. But whenever you see that your printer isn't
- being properly set up, or spot a particular command that you know will cause
- trouble (because it contains ASCII codes that you have redefined), make sure
- it is "bracketed" somehow by commands to turn off translation:
- 1B FF 30 ;make PI INACTIVE
- 1B 72 80 ;now set the margin correctly
- 1B FF 31 ;make PI ACTIVE again
- Often this approach will be adequate, particularly if you seldom redefine any
- characters in the normal ASCII range 00-7F.
-
- THE CAUTIOUS METHOD: in general, make PI INACTIVE. But in every text
- file you are going to print, embed the PI ON command (1B FF 31) at the
- beginning, and PI OFF (1B FF 30) at the end.
-
-
-
-
- TECHNICAL NOTES
-
- PI is a replacement interrupt handler. Because it operates at this
- "lowest" level, it will intercept ALL printer output regardless of its origin
- (redirection, etc).
- Because PI is a Terminate and Stay Resident (TSR) utility, once installed
- it cannot be removed without a reset. You should not install PI from within a
- DOS shell while executing another program, as this will corrupt the DOS memory
- allocations; other uses of PI.COM (reading files, etc) cause no problems in
- this situation.
-
-
-
- PI and its documentation are (c)1988 E.Meyer, all rights reserved.
- They may be freely distributed, but not modified or sold for profit without
- my written consent. The user takes full responsibility for any damages
- resulting from the use (or misuse) of this program. Please report any
- problems encountered.
-
- Eric Meyer
- 427 N. Washington #4 CompuServe [74415,1305]
- Bloomington, IN 47401
-